Las Reliquias de Tolti Aph

An interactive fiction by Graham Nelson (2005) - the Inform 7 source text

Home page

Contents
Previous
Next

Complete text
Section E(c) - Coordenadas espaciales

A spatial coordinate is a kind of value. <9,24,24> specifies a spatial coordinate with parts maze level, easting (without leading zeros), northing (without leading zeros). A room has a spatial coordinate called grid position. Definition: A room is unlocated if its grid position is <0,0,0>. Definition: A room is located if it is not unlocated.[1]

To decide which number is the current maze level:
    let L be the maze level part of the grid position of the location;
    decide on L.

The previous maze level is a number that varies.

Every turn:
    if the location is a labyrinth room and the location is not the Arco de Seto
    begin;
        if the current maze level is not the previous maze level
        begin;
            if the current maze level is 1, say "Parpadeas en la penumbra, a pesar de estar bajo la luz natural del crepúsculo, sintiendo nuevamente una leve brisa en tu cara. Estás de vuelta en el familiar laberinto vallado, en la superficie.";
            if the previous maze level is 1, say "Subsuelo. El laberinto parece extenderse en pasajes mágicamente iluminados; oradados en la roca con precisión.";
        end if;
    end if;
    change the previous maze level to the current maze level.

A direction has a spatial coordinate called vector. North has vector <0,0,1>. South has vector <0,0,24>. East has vector <0,1,0>. West has vector <0,24,0>. Down has vector <1,0,0>. Up has vector <9,0,0>.[2] Definition: A direction is vectorial if its vector is not <0,0,0>.[3] Definition: A direction is vertical if it is up or it is down.

To decide which spatial coordinate is the vector sum of (V1 - a spatial coordinate) and (V2 - a spatial coordinate):
    let L be the maze level part of V1 plus the maze level part of V2;
    let L be the remainder after dividing L by 10;
    let E be the easting part of V1 plus the easting part of V2;
    let E be the remainder after dividing E by 25;
    let N be the northing part of V1 plus the northing part of V2;
    let N be the remainder after dividing N by 25;
    if L is 0 or L is 9, decide on <0,0,0>;
    if E is 0 or E is 24, decide on <0,0,0>;
    if N is 0 or N is 24, decide on <0,0,0>;
    let the sum be the spatial coordinate with maze level part L easting part E northing part N;
    decide on the sum.[4]

To decide which spatial coordinate is the vector difference of (V1 - a spatial coordinate) and (V2 - a spatial coordinate):
    let L be the maze level part of V1 minus the maze level part of V2;
    let L be the remainder after dividing L by 10;
    let E be the easting part of V1 minus the easting part of V2;
    let E be the remainder after dividing E by 25;
    let N be the northing part of V1 minus the northing part of V2;
    let N be the remainder after dividing N by 25;
    let the sum be the spatial coordinate with maze level part L easting part E northing part N;
    decide on the sum.


Notes

[1]. Inform no construye automáticamente los refijos un-: son demasiado impredecibles en Inglés. Por ejemplo, en ROTA "undead" tiene una definición que para nada es equivalente a "not dead".

[2]. Como esto demuestra, Inform permite añadir o modificar incluso los conceptos más fundamentales construidos en Inform.

[3]. Por ejemplo, "nordeste" y "fuera" son direcciones no-vectoriales en este sentido. El Laberinto ocupa una cuadrícula cúbica y nunca tiene conexiones en esas direcciones.

[4]. Todo este tema de restas-tras-dividir es para permitirnos tener vectores relativos con valores negativos. Así que un movimiento sencillo hacia el oeste se consigue añadiendo <0,24,0> a la posición, porque 24 es lo mismo que -1 cuando estamos tratando con números en un rango desde 0 a 23. Pero el Laberinto no "da la vuelta": posiciones legales de la cuadrícula son donde L debe de ser entre 1 y 8, y E y N deben de ser entre 1 y 23, con el valor especial <0,0,0> reservado como el vlaor "ninguna posición".